#!/bin/bash
#
#  (clandestine.googlecode.com)  libclandestine: yet another script kiddie's bash framework
#
#
#
function Isset () { (( $# >= 0 )) || return 0
	declare -- PTR
	for PTR; do [[ 'isset' == "${!PTR+isset}" ]] || return 255; done
	return 0
}
function Integers () { (( $# >= 0 )) || return 0
	declare -- PTR  VAL  REUNSET
	[[ "$SHELLOPTS" =~ 'nounset' ]] && { REUNSET=1; set +u; }
	for PTR; do
		if Isset "$PTR"; then
			VAL="${!PTR}"
			declare -i TEST
			(( TEST=VAL )) &> /dev/null || true
			if [[ "$TEST" ]]; then let "$PTR = TEST" || true; else
				Debug "variable's [$PTR] value [$VAL] conversion to integer failed, setting to zero"
				let "$PTR = 0" || true
			fi
			unset TEST
		else
			let "$PTR = 0" || true
			Debug "unset variable [$PTR] was globally set to zero"
		fi
	done
	(( REUNSET )) && set -u
	return 0
}
